/******************************************************************************

	COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010.

	This file is part of Maxsi Engine.

	Maxsi Engine is free software: you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or (at your
	option) any later version.

	Maxsi Engine is distributed in the hope that it will be useful, but WITHOUT
	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
	for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Maxsi Engine. If not, see <http://www.gnu.org/licenses/>.

	MaxsiEngine.dll
	A general purpose C++ library for the Maxsi Technology Project.

	MaxsiDefines.h
	General defines.

******************************************************************************/

#ifndef MaxsiDefines_H
#define MaxsiDefines_H

//=============================================================================
//	Detect whether we are an Maxsi Engine implementation or not.
//=============================================================================
#if defined(Maxsi_Engine_Library) || defined(Maxsi_Engine_Custom_Implementation)
#define Maxsi_Engine_Implementation
#endif

//=============================================================================
//	The Maxsi Technology Project defines the following kinds of releases/
//	compile modes for projects that are part of Maxsi Technology.
//
//	Stable - A strict build with all known bugs fixed and all deprecated code
//	         disabled or removed and all temporary "Remove Me" code removed.
//	
//	Release - A build with all serious bugs fixed and all deprecated code
//	          disabled or removed and all temporary "Remove Me" code removed.
//
//	Beta - A build with no debugging purpose but with deprecated code enabled
//	       and with possible known bugs.
//
//	Debug - A debug build with deprecated code enabled and filled with code
//	        section marked Remove Me.
//
//	To compile in any of these modes, please define one of the following
//	mutually exclusive macros.
//
//	- Maxsi_Stable_Build
//	- Maxsi_Release_Build
//	- Maxsi_Beta_Build
//	- Maxsi_Debug_Build
//=============================================================================

//=============================================================================
//	Rules for compiling a stable version of Maxsi Technology.
//=============================================================================
#if defined(Maxsi_Stable_Build)

	#define Maxsi_Disable_Bugs
	#define Maxsi_Disable_Deprecated

	#ifdef Maxsi_Release_Build
	#undef Maxsi_Release_Build
	#endif

	#ifdef Maxsi_Beta_Build
	#undef Maxsi_Beta_Build
	#endif

	#ifdef Maxsi_Debug_Build
	#undef Maxsi_Debug_Build
	#endif

	#ifdef Maxsi_Ignore_Bugs
	#undef Maxsi_Ignore_Bugs
	#endif

#endif

//=============================================================================
//	Rules for compiling a release version of Maxsi Technology.
//=============================================================================
#if defined(Maxsi_Release_Build)

	#define Maxsi_Disable_Deprecated

	#ifdef Maxsi_Stable_Build
	#undef Maxsi_Stable_Build
	#endif

	#ifdef Maxsi_Beta_Build
	#undef Maxsi_Beta_Build
	#endif

	#ifdef Maxsi_Debug_Build
	#undef Maxsi_Debug_Build
	#endif

	#ifdef Maxsi_Ignore_Bugs
	#undef Maxsi_Ignore_Bugs
	#endif

	#ifdef Maxsi_Disable_Bugs
	#undef Maxsi_Disable_Bugs
	#endif

#endif

//=============================================================================
//	Rules for compiling a beta version of Maxsi Technology.
//=============================================================================
#if defined(Maxsi_Beta_Build)

	// Enable functions that aren't ready for Release Builds.
	#define Maxsi_Beta

	#ifdef Maxsi_Stable_Build
	#undef Maxsi_Stable_Build
	#endif

	#ifdef Maxsi_Release_Build
	#undef Maxsi_Release_Build
	#endif

	#ifdef Maxsi_Debug_Build
	#undef Maxsi_Debug_Build
	#endif

	#ifdef Maxsi_Ignore_Bugs
	#undef Maxsi_Ignore_Bugs
	#endif

	#ifdef Maxsi_Disable_Bugs
	#undef Maxsi_Disable_Bugs
	#endif

	#ifdef Maxsi_Disable_Deprecated
	#undef Maxsi_Disable_Deprecated
	#endif

#endif

//=============================================================================
//	Rules for compiling a debug version of Maxsi Technology.
//=============================================================================
#if defined(Maxsi_Debug_Build)

	// Enable functions that aren't ready for Release Builds.
	#define Maxsi_Beta

	#ifdef Maxsi_Stable_Build
	#undef Maxsi_Stable_Build
	#endif

	#ifdef Maxsi_Release_Build
	#undef Maxsi_Release_Build
	#endif

	#ifdef Maxsi_Beta_Build
	#undef Maxsi_Beta_Build
	#endif

	#ifdef Maxsi_Ignore_Bugs
	#undef Maxsi_Ignore_Bugs
	#endif

	#ifdef Maxsi_Disable_Bugs
	#undef Maxsi_Disable_Bugs
	#endif

	#ifdef Maxsi_Disable_Deprecated
	#undef Maxsi_Disable_Deprecated
	#endif

#endif

//=============================================================================
//	Enable special features that aren't ready for release builds.
//=============================================================================
#ifdef Maxsi_Beta

	#define ME_MFFDisabled

	// The version specifier for Beta and Debug Builds have -BETA appended.
	#define	Maxsi_BuildVersionFull  Maxsi_BuildVersion _MESTR("-BETA")

	// The Maxsi_Beta and Maxsi_Release macros are mutually exclusive.
	#ifdef Maxsi_Release
	#undef Maxsi_Release
	#endif

#else

	#define ME_MFFDisabled

	#define	Maxsi_BuildVersionFull  Maxsi_BuildVersion

	// We are not a Maxsi_Beta build.
	#define Maxsi_Release

#endif

//=============================================================================
//	We are not done porting from char* to MESTR*, please define this by 
//	default, when we are.
//=============================================================================
#ifdef WIN32

	#ifndef Maxsi_Disable_Deprecated
		//#define	ME_USE_MULTIBYTE_STRING // Deprecated by Maxsi_Using_Unicode_Internally.
		//#define	Maxsi_Use_Unicode_Internally // Deprecated by Maxsi_Using_Unicode_Internally.
	#endif

	#define	Maxsi_Using_Unicode_Internally

#else

	#ifndef Maxsi_Disable_Deprecated
		#define ME_USE_MULTIBYTE_STRING // Deprecated by Maxsi_Using_Unicode_Internally.
		#define	Maxsi_Use_Unicode_Internally // Deprecated by Maxsi_Using_Unicode_Internally.
	#endif

	#define Maxsi_Using_Unicode_Internally

#endif

//=============================================================================
//	Configuration of optional and system-dependent features.
//=============================================================================
#if defined(WIN32)
	
	// We are using the Windows platform.
	#define Maxsi_Support_W32

#endif

#if defined(WIN64)

	// We are even using the Windows 64-bit platform. (WIN32 is always defined, even if WIN64 is too).
	#define Maxsi_Support_W64

#endif

#if defined(linux)

	// We are using the Linux platform.
	#define Maxsi_Support_Linux

	// The GNU/Linux platform is POSIX compliant.
	#define Maxsi_Support_POSIX

	// We support the GTK+ Window System on the GNU/Linux platform.
	#ifndef Maxsi_Disable_Deprecated
		#define Maxsi_Using_GTK // Deprecated by Maxsi_Support_GTK.	
	#endif
	#define Maxsi_Support_GTK
	// The Linux Kernel implements the Epoll interface for async IO
	#define Maxsi_Support_Epoll

#endif

#if defined(Maxsi_Support_POSIX)

	// If POSIX is supported then the Pthreads multi-threading library is too.
	#define Maxsi_Support_Pthreads

	// The iconv text-encoding conversion functions are part of POSIX:2001.
	#define Maxsi_Using_libiconv

	// We have successfully implemented stack allocation here.
	#define Maxsi_Stack_Alloc_Supported

	//#define Maxsi_Support_MaxsiIO

	#define Maxsi_Support_Buggy_vswprintf

#endif

#if defined(__MINGW_H) || defined(__MINGW32__) || defined(__MINGW64__)

	#define Maxsi_Support_MinGW

	#define Maxsi_Support_Buggy_vswprintf

#endif

#ifdef _MSC_VER

	// Microsoft Visual Studio doesn't support the useful and lovely stdint.h header!
	#define Maxsi_Using_SelfMade_StdInt

#endif

//=============================================================================
//	Macros to control whether we are using namespaces or not.
//=============================================================================
#define BeginMaxsiNamespace namespace Maxsi {
#define EndMaxsiNamespace }
#define UsingMaxsiNamespace using namespace Maxsi;

#define BeginMaxsiUINamespace namespace MaxsiUI {
#define EndMaxsiUINamespace }
#define UsingMaxsiUINamespace using namespace MaxsiUI;

//=============================================================================
//	Declaration of the common namespaces, if we use them.
//=============================================================================
BeginMaxsiNamespace
EndMaxsiNamespace

//=============================================================================
//	Define a global version identification string.
//=============================================================================
#define MaxsiEngine_VersionInfo _MESTR("Application/x-MaxsiEngine/") _MESTR(Maxsi_BuildName) _MESTR("/") _MESTR(Maxsi_BuildVersion) _MESTR("/") _MESTR(__DATE__)

#define Maxsi_Debug_RecodeString

#endif

